@extends('plugin.layout.base')
@section('add_css')

@endsection
@section('content')
    @include('plugin.'.$controller_base_lower.'.form')
    @include('plugin.layout.table')
@endsection
@section('foot_js')
    @include('plugin.layout.ListConfig')
    <script>
        listConfig.open_height = '600px';
        listConfig.open_width = '800px';
        layui.use(['index', 'listTable'], function () {
            var $ = layui.$
                , listTable = layui.listTable;

            cols = [[
                {type: 'checkbox'}
                , {field: 'id', width: 80, title: 'ID', sort: true}
                , {field: 'name', title: '产品名称'}
                , {field: 'user_name', title: '会员', width: 120}
                , {field: 'total', title: '总价', width: 120,templet:function (d) {
                        return '<span class="text-success">'+d.total+'</span>';
                    }}

                , {field: 'mark', title: '系统备注'}
                , {
                    field: 'status_name', width: 80, title: '状态', templet: function (d) {
                        return layui_label(d.status_name, 'info')
                    }
                }
                , {field: 'year_numbers', title: '累计年份', width: 150}
                , {field: 'check_year_numbers', title: '审核增加年份', width: 150}
                , {
                    field: 'buy_at', title: '时间', width: 250, templet: function (d) {
                        var html = '';

                        if(d.refund_at)
                        {
                            html += '<p class="text-danger">退款日期:' + d.refund_at + '</p>'
                        }else
                        {
                            html += '<p>生效日期:' + d.buy_at + '</p>'
                            html += '<p class="text-danger">过期日期:' + d.end_at + '</p>'
                        }
                        return html;
                    }
                }


                , {
                    title: '操作', minWidth: 150, align: 'center', templet: function (d) {
                        var arr=[
                            ' <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>',
                            '<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>'
                        ];
                        if(d.status!=2){
                            return arr.join('');
                        }else{
                            return '';
                        }
                    }
                }
            ]]
            //渲染
            listTable.render(listConfig.index_url, cols);
            //监听搜索
            listTable.search();


        });
    </script>
@endsection